<template>
  <div class="kaoshi">



    <el-row type="gird" style="width: 100%">

      <el-row >
        <el-col :span="10" :offset="2">
        <el-button  @click="loginOut">退出登录</el-button>
        </el-col>
      </el-row>
      <el-row  style="padding-top: 30px">
        <el-col :span="10" :offset="2">
          <el-button  type="primary" @click="handleChoose">考试报名</el-button>
        </el-col>
        <el-col :span="12">
          <el-button type="primary"  @click="handleUserInfo">个人信息</el-button>
        </el-col>
      </el-row>
      <el-row style="padding-top: 30px">
        <el-col :span="10" :offset="2">
          <el-button type="primary" @click="handleBaomingData">已报信息</el-button>
        </el-col>
<!--        <el-col :span="12">-->
<!--          <el-button type="primary" @click="handleDownload">材料下载</el-button>-->
<!--        </el-col>-->
      </el-row>





    </el-row>
    <el-dialog
      :visible.sync="open"
      title="选择报名类型"
      width="80%"
      height="20%"
      append-to-body>
      <el-row style="text-align:center">
        <el-button type="primary" @click="handleBaoming('N')">学历报名</el-button>
        <el-button type="primary" @click="handleBaoming('Y')">工龄报名</el-button>
      </el-row>

      <el-row>
        <p>建议使用手机浏览器或者PC电脑打开访问，否则某些功能可能无法正常使用</p>
      </el-row>

      <el-row style="text-align:center">
        <el-button @click="cancel">取 消</el-button>
      </el-row>
    </el-dialog>


  </div>
</template>

<script>
import {checkUserInfo} from "@/api/system/userInfo";
import {MessageBox} from "element-ui";

export default {
  name: "Shouye",
  data() {
    return {
      // 版本号
      open: false,
      imageUrl: ''
    }
  },
  created() {
    this.checkInitInfo()
  },
  methods: {
    cancel() {
      this.open = false
    },
    handleChoose() {
      this.open = true
    },
    handleBaomingData() {
      this.$router.push({path: "/kaoshi/baomingData"}).catch(() => {
      })
    },
    handleBaoming(type) {
      this.$router.push({path: "/kaoshi/baoming", query: {seniorityFlag: type}}).catch(() => {
      })
    },
    handleDownload() {
      this.$router.push({path: "/kaoshi/download"}).catch(() => {
      })
    },
    handleUserInfo() {
      this.$router.push({path: "/kaoshi/userInfo/info"}).catch(() => {
      })
    },
    loginOut(){
      this.$confirm('确定注销并退出系统吗？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$store.dispatch('LogOut').then(() => {
          location.href = '/index'
        })
      }).catch(() => {})
    },
    checkInitInfo() {
      checkUserInfo().then(res => {
        if (res.data) {
          MessageBox.confirm('您的身份信息还没有完善！请先完善身份信息', '安全提示', {
            confirmButtonText: '确定',
            showCancelButton: false,
            closeOnClickModal:false,
            showClose:false,
            type: 'warning'
          }).then(() => {
            // router.push({ name: 'UserInfo', params: { activeTab: 'resetPwd' } })
            this.$router.push({path: "/kaoshi/userInfo/add"}).catch(() => {
            })
          }).catch(() => {
          })
        }
      })
    },
  }
}
</script>

<style scoped lang="scss">
.kaoshi {
  max-width: 90vw;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}


//.kaoshi {
//  max-width: 90vw;
//  margin: auto;
//  touch-action: pan-y;
//  display: grid;
//  justify-content: center;
//  align-items: center;
//  overflow-y: hidden;
//}


</style>

